Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

How to hide/display part of question text based on {TOKEN/LASTNAME} ?

  • laura.bonacini
  • laura.bonacini's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 10 months ago - 1 year 10 months ago #229723 by laura.bonacini
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 3.22.24+200630
Own server or LimeSurvey hosting: don't know
Survey theme/template: fruity / inherit
==================

Hello
How to hide/display part of question text based on {TOKEN/LASTNAME}?

A part (see screenshot) of question text => for all {TOKEN/LASTNAME} in my relevance equation:
(((TOKEN:LASTNAME == "BCFR")) or 
(((TOKEN:LASTNAME == "BRBDR")) or 
((TOKEN:LASTNAME == "CRRD")) or 
((TOKEN:LASTNAME == "IQECAD")) or 
((TOKEN:LASTNAME == "IQED")) or 
((TOKEN:LASTNAME == "IQEDFOOT")) or 
((TOKEN:LASTNAME == "NSIH_CDIF")) or 
((TOKEN:LASTNAME == "NSIH_SEP")))


B part only if {TOKEN/LASTNAME} in
(((TOKEN:LASTNAME == "BCFR")) or 
((TOKEN:LASTNAME == "BRBDR")) or 
((TOKEN:LASTNAME == "CRRD")) or 
((TOKEN:LASTNAME == "IQECAD")) or 
((TOKEN:LASTNAME == "IQED")) or 
((TOKEN:LASTNAME == "IQEDFOOT")))

Could you let me know where to code in the question text this logic ?
Thanks in advance

Laura
Attachments:
Last edit: 1 year 10 months ago by laura.bonacini.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 10 months ago #229724 by tpartner

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • laura.bonacini
  • laura.bonacini's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 10 months ago - 1 year 10 months ago #229730 by laura.bonacini
How to combine multi-test in a if function on LS ?

The following code is not working:

if( (((TOKEN:LASTNAME == "NSIH_SEP")) or ((TOKEN:LASTNAME == "NSIH_CDIF"))), "" , "B part")

The question is exclude when TOKEN:LASTNAME == "NSIH_SEP" or == "NSIH_CDIF".

Can someone help me out with this ?
Many thanks
Last edit: 1 year 10 months ago by laura.bonacini.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 10 months ago - 1 year 10 months ago #229731 by Joffm
Hi, Laura,
the buzzword is "Tayloring".
As shown here
[url] manual.limesurvey.org/ExpressionScript_H...7BMrs.7D_Smith....22 [/url]

Gender has to be replaced by TOKEN:LASTNAME and Mr. resp. Mrs. by your texts

Your question (without your orgy of brackets)
{if(TOKEN:LASTNAME == "NSIH_SEP" or TOKEN:LASTNAME == "NSIH_CDIF", "" , "B part")}

You see that the equations will get very long.
Why don't you add a TOKEN:ATTRIBUTE where all Lastnames who are to see part A, get a "1", Lastnames who are to see B, get a "2".

Then your IF is only
{if(TOKEN_ATTRIBUTE_1=="1","Text A",if(TOKEN_ATTRIBUTE_1=="2","Text B".""))}

Joffm

I wrote the first part before Tony answered.

Anyway: You should always send a lss export of these relevant questions.
Many times there is only a small typo, and we write and write and write without noticing it.

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 10 months ago by Joffm.
The following user(s) said Thank You: laura.bonacini

Please Log in to join the conversation.

  • laura.bonacini
  • laura.bonacini's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 10 months ago #229733 by laura.bonacini
Hi Joffm

It worked! Many thanks.
I read somewhere that we need to use double brackets when using OR operator. This is why there were so many brackets in my inital code.

Best regards
Laura

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose